Find<TQuery,TResult>(DicomScp,TQuery,DicomMatchDelegate<TResult>) Method

Summary
Sends a C-FIND-REQ message to a peer member of a connection defined by Scp. The C-FIND-REQ is defined by the Query parameter.
Syntax
C#
C++/CLI
public void Find<TQuery, TResult>( 
   DicomScp Scp, 
   TQuery Query, 
   DicomMatchDelegate<TResult> OnMatch 
) 
public: 
void Findgeneric<typename TQuery> 
generic<typename TResult> 
(  
   DicomScp^ Scp, 
   _TQuery^_ Query, 
   DicomMatchDelegate<TResult^>^ OnMatch 
)  

Parameters

Scp
The peer connection to send the C-FIND-REQ to.

Query
The query information that describes the DICOM datasets to be found.

OnMatch
The method to call when a dataset successfully matches the query parameters.

Type Parameters

TQuery
The type of the query.

TResult
The type of the query result.

Remarks

A DicomDataSet will be created from the Query parameter. This DicomDataSet will then be sent in the C-FIND-RQ. The Query class should be decorated with the correct attributes for creating the dataset (described in more detail below). The OnBeforeAdd delegate will be called before a tag is added to the dataset.

The Query argument determines the command and data elements of the C-FIND-RQ.

The sample class MyModalityWorklistQuery below shows examples of the attributes.

C#
 [Instance(DicomClassType.ModalityWorklist,DicomUidType.ModalityWorklistFind)] 
    public class MyModalityWorklistQuery 
    { 
        private PersonName _PatientName = new PersonName(); 
 
        [Element(DicomTag.PatientName)] 
        [TypeConverter(typeof(PersonNameConverter))] 
        public PersonName PatientName 
        { 
            get { return _PatientName; } 
            set { _PatientName = value; } 
        } 
 
        private string _PatientId = string.Empty; 
 
        [Element(DicomTag.PatientID)] 
        public string PatientId 
        { 
            get { return _PatientId; } 
            set { _PatientId = value; } 
        } 
        ... 
    } 
vb 
 <Instance(DicomClassType.ModalityWorklist,DicomUidType.ModalityWorklistFind)> _ 
 Public Class MyModalityWorklistQuery 
		Private _PatientName As New PersonName() 
 
		<Element(DicomTag.PatientName), TypeConverter(GetType(PersonNameConverter))> _ 
		Public Property PatientName() As PersonName 
			Get 
				Return _PatientName 
			End Get 
			Set(ByVal value As PersonName) 
				_PatientName = value 
			End Set 
		End Property 
 
		Private _PatientId As String = String.Empty 
 
		<Element(DicomTag.PatientID)> _ 
		Public Property PatientId() As String 
			Get 
				Return _PatientId 
			End Get 
			Set(ByVal value As String) 
				_PatientId = value 
			End Set 
		End Property 
	   Private ... 
 End Class 

The class level Instance attribute should be included to specify a DicomUidType (the SOP Class of the DICOM find) and an associated DicomClassType that is used to create an internal DicomDataSet that specifies the data set component of the C-FIND-RQ. The elements in the internal DicomDataSet correspond to the data you wish to find.

For example, passing an instance of the MyModalityWorklistQuery class below would result in a C-FIND-RQ command set specifying:

(0000,0002) Affected SOP Class UID 1.2.840.10008.5.1.4.31 (Modality Worklist Information Model - FIND)

If the class level Instance attribute is not specified, then the Find SOP Class defaults to DicomUidType.StudyRootQueryFind

Example values for the Instance attribute pairs are shown below:

DicomUidType UID DicomClassType
DicomUidType.PatientRootQueryFind 1.2.840.10008.5.1.4.1.2.1.1 DicomClassType.PatientRootQueryPatient
DicomClassType.PatientRootQueryStudy
DicomClassType.PatientRootQuerySeries
DicomClassType.PatientRootQueryImage
DicomUidType.StudyRootQueryFind 1.2.840.10008.5.1.4.1.2.2.1 DicomClassType.StudyRootQueryStudy
DicomClassType.StudyRootQuerySeries
DicomClassType.StudyRootQueryImage
DicomUidType.ModalityWorklistFind 1.2.840.10008.5.1.4.31 DicomClassType.ModalityWorklist
DicomUidType.GeneralPurposeWorklistFind 1.2.840.10008.5.1.4.32.1 DicomClassType.GeneralPurposeWorklist
DicomUidType.HangingProtocolInformationModelFind 1.2.840.10008.5.1.4.38.2 DicomClassType.HangingProtocolInformationModelFind

An Element attribute can be included to map a class member to a DICOM element. Note that in the MyModalityWorklistQuery class, the PatientId member is decorated with an Element attribute that associates it with the DicomTag.PatientID. For example, if the PatientId member of the MyModalityWorklistQuery object contains "123", then the dataset component of the C-FIND-RQ will contain

(0010,0020) Patient ID 123

If the PatientId member of the MyModalityWorklistQuery object is empty, then no corresponding DICOM element will be added to the dataset component of the C-FIND-RQ.

Example

Finds all modality worklist items.

C#
using Leadtools.Dicom.Common.DataTypes.Modality; 
using Leadtools.Dicom; 
using Leadtools.Dicom.Scu.Queries; 
using Leadtools.Dicom.Scu; 
using Leadtools.Dicom.Common.Extensions; 
using Leadtools.Dicom.Scu.Common; 
 
 
public void FindMWL() 
{ 
   DicomEngine.Startup(); 
   DicomNet.Startup(); 
 
   ModalityWorklistQuery query = new ModalityWorklistQuery(); 
   DicomScp scp = new DicomScp(); 
   QueryRetrieveScu findMwl = new QueryRetrieveScu(); 
 
   scp.AETitle = "MWL_SERVER"; 
   scp.Port = 104; 
   scp.Timeout = 60; 
   scp.PeerAddress = IPAddress.Parse("192.168.0.209"); 
   findMwl.AETitle = "LEAD_CLIENT"; 
   findMwl.Find<ModalityWorklistQuery, ModalityWorklistResult>(scp, query, FoundMatch); 
 
   DicomEngine.Shutdown(); 
   DicomNet.Startup(); 
} 
 
private void FoundMatch(ModalityWorklistResult result, DicomDataSet ds) 
{ 
   string message = 
  "\r\n\tAccession #:\t\t " + result.AccessionNumber + 
  "\r\n\tPatient Name:\t\t" + result.PatientName.Full + 
  "\r\n\tScheduled Start Date:\t" + result.ScheduledProcedureStepSequence[0].ScheduledProcedureStepStartDate.Value.ToShortDateString(); 
 
   Console.WriteLine(message); 
} 
Requirements

Target Platforms

Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Dicom.Scu Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.